﻿namespace Ruirun.Mes.Entities
{
    /// <summary>
    /// 物料
    /// </summary>
    [Description("物料")]
    [EntitySchema(Constants.Wms)]
    public class MaterialCategory : EntityBase<Guid>
    {
        /// <summary>
        /// 获取或设置 父编号
        /// </summary>
        [DisplayName("父编号")]
        public Guid? ParentId { get; set; }

        [Required]
        [DisplayName("类别名称"), StringSize(StringSizeType.Name)]
        public string Name { get; set; }

        [DisplayName("类别描述"), StringSize(StringSizeType.Data)]
        public string Description { get; set; }

        /// <summary>
        /// 获取或设置 节点树形路径
        /// <para>树链Id根据一定格式构建的字符串，形如："$1$,$3$,$4$,$7$"，编辑时更新。</para>
        /// </summary>
        [Required]
        [StringSize(StringSizeType.Description)]
        [DisplayName("节点树形路径")]
        public string TreePathString { get; set; } = string.Empty;

        /// <summary>
        /// 获取或设置 父组织机构信息
        /// </summary>
        public virtual MaterialCategory Parent { get; set; }

        /// <summary>
        /// 获取或设置 子组织机构集合
        /// </summary>
        public virtual ICollection<MaterialCategory> Children { get; set; } = new List<MaterialCategory>();

    }
}